<admintpl file="header"/>
</head>
<body>
<div class="wrap">
    <form method="post" class="form-horizontal js-ajax-form" id="myform" action="{:U('NewsColumnEntrance/addChooseEntrance')}"
			  enctype="multipart/form-data">
         <div class="control-group">
            <label class="span1 control-label" style="width: 90px;"><span style="color:red;"></span>快捷入口</label>
            <div class="span3">
            	<select name="choose_title" id="choose_title">
            		<foreach name="choose_data" item="vo" key="keys">
    					<option value="{$vo.entrance_id}" >{$vo.title}</option>
    				</foreach>
    			</select>
            </div>
        </div>

        <div class="control-group">
			<label class="span1 control-label" style="width: 90px;"><span style="color:red;"></span>权重</label>
			<div class="span3">
				<input type="text" name="weight"  id="weight" value="">
			</div>
		</div>
		
		<input type="hidden" name="{$id_type}" id="{$id_type}" value="{$id_val}">
		<input type="hidden" name="entrance_id" id="entrance_id" value="<?php echo $info_data['entrance_id'];?>">
		<input type="hidden" name="type_data" id="type_data" value="{$type_data}">
        <div class="form-actions" style="padding-left:260px;">
        	<a class="btn btn-primary" id="ajaxform">提 交</a>
            &nbsp;&nbsp;<a class="btn" id="ajaxback">{:L('BACK')}</a>
        </div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript"
        src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/jquery.validate.min.js"></script>
<script src="__PUBLIC__/js/layer/layer.js"></script>
<script>
// ajax 提交表单
$(document).ready(function(){
    $("#ajaxform").click(function(){    // 提交按钮触发事件
        var tourl = $("#myform").attr("action");    // 获取 表单的 提交地址
        var entrance_id=$("#choose_title").find("option:selected").val(); 
        var type_data=$("#type_data").val(); 
        var weight = $("#weight").val();
        var column_id = $("#column_id").val();
        var area_id = $("#area_id").val();
        $.post(tourl,{entrance_id:entrance_id,weight:weight,type_data:type_data,column_id:column_id,area_id:area_id},function(result){
        	if(result == '1'){
        		var msg = '保存成功';
        	}else if(result == '2'){
        		var msg = '保存失败';
        	}else{
        		var msg = result;
        	}
        	
    		parent.layer.msg(msg,{time:2000},1,function(a){
        		
    		});
    		setTimeout(function(){
    			var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
    			parent.layer.close(index);
    		}, 1000);
          });
    });
    $("#ajaxback").click(function(){
    	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
		parent.layer.close(index);
    });
});
</script>
</body>
</html>